import pandas as pd

# read in data
meta = pd.read_csv('../../data/metadata/nasal/nasal_metadata.csv', index_col='SampleID')
meta['age_at_collection'] = (pd.to_datetime(meta['CollectionDate']) - pd.to_datetime(meta['DOB'])).dt.days

titer_data = pd.read_csv('../../data/vaccine_response/vaccine_response_y1.tsv', sep='\t', index_col=0)
titer_data.index = [int(i.split('Baby')[-1]) for i in titer_data.index]

# get per baby titer information
nasal_titer_data = pd.DataFrame({sample: titer_data.loc[row['BabyN']] for sample, row in meta.iterrows() if row['BabyN'] in titer_data.index}).transpose()
nasal_titer_data.to_csv('../../data/metadata/nasal/nasal_titers_yr1.csv', index_label='SampleID')
